package com.yunhe.common.constant;

/**
 * @title: DataTransferConsts
 * @Author Chen Lun
 * @Date: 2021/1/22
 */
public class DataTransferConsts {

    public static final String heartbeatPid = "99996";

    public enum TransferType {
        RECOLLECT("Recollect", "补招");
        private final String value;
        private final String title;

        TransferType(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }

        public String title() {
            return title;
        }
    }

    public enum Heartbeat {
        Connected(0D, "连接"),
        Disconnected(1D, "断开连接");
        private final Double value;
        private final String title;

        Heartbeat(Double value, String title) {
            this.value = value;
            this.title = title;
        }

        public Double value() {
            return value;
        }

        public String title() {
            return title;
        }
    }

    public static Long getHeartbeatPid(Long stationCode) {
        return getHeartbeatPid(stationCode, null);
    }

    public static Long getHeartbeatPid(Long stationCode, Long deviceCode) {
        if (deviceCode == null) {
            return Long.parseLong(stationCode + heartbeatPid);
        } else {
            return Long.parseLong(stationCode + heartbeatPid + deviceCode);
        }
    }
}
